<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
	<p:messages autoUpdate="true" />
	<h:form>
		<p:dataList id="incomes" value="#{customerMaintBean.loanApplication.incomes}" var="income" type="definition" emptyMessage="Nincs jövedelem rögzítve">
			<p:fieldset legend="Jövedelem">
				<p:dialog header="Selected Dates" widgetVar="dialog" showEffect="fade" hideEffect="fade">
					<h:panelGrid id="displayIncomeData" columns="2" cellpadding="5">
						<h:outputText value="Popup Date:" />
						<h:outputText value="#{income.lengthOfEmployement}">
							<f:convertDateTime pattern="yyyy/MM/dd" />
						</h:outputText>
					</h:panelGrid>
				</p:dialog>
				<h:panelGrid columns="3">
					<p:outputLabel for="incomeType" value="Jövedelem típusa" />
					<p:selectOneMenu id="incomeType" required="true" value="#{income.incomeType}">
						<f:selectItem itemLabel="Kérem válasszon!" itemValue="" />
						<f:selectItems value="#{mainData.incomeTypes}" />
					</p:selectOneMenu>
					<p:message for="incomeType" />

					<p:outputLabel for="rank" value="Beosztás" />
					<p:selectOneMenu id="rank" required="true" value="#{income.rank}">
						<f:selectItem itemLabel="Kérem válasszon!" itemValue="" />
						<f:selectItems value="#{mainData.ranks}" />
					</p:selectOneMenu>
					<p:message for="rank" />

					<p:outputLabel for="incomeAmount" value="Jövedelem összege" />
					<p:inputText id="incomeAmount" required="true" value="#{income.incomeAmount}" />
					<p:message for="incomeAmount" />

					<p:outputLabel for="employer" value="Munkáltató adatai:" />
					<h:outputText id="employer" styleClass="outputLabel" value="" />
					<p:message for="employer" />

					<p:outputLabel for="companyName" value="Munkáltató neve" />
					<p:inputText id="companyName" required="true" value="#{income.companyName}" />
					<p:message for="companyName" />

					<p:outputLabel for="companyAddress" value="Cím" />
					<p:inputText id="companyAddress" required="true" value="#{income.companyAddress}" />
					<p:message for="companyAddress" />

					<p:outputLabel for="registrationNumber" value="Cégjegyzékszám" />
					<p:inputText id="registrationNumber" required="true" value="#{income.registrationNumber}" />
					<p:message for="registrationNumber" />

					<p:outputLabel for="taxNumber" value="Adószám" />
					<p:inputText id="taxNumber" required="true" value="#{income.taxNumber}" />
					<p:message for="taxNumber" />

					<h:outputLabel for="lengthOfEmployement" value="Munkaviszony kezdete:" />
					<p:calendar id="lengthOfEmployement" required="true" value="#{income.lengthOfEmployement}" maxdate="#{currentDate}" showOn="button"/>
					<!-- 							<p:calendar id="lengthOfEmployement" required="true" value="#{income.lengthOfEmployement}" maxdate="now" /> -->

					<p:messages autoUpdate="true" />
				</h:panelGrid>
			</p:fieldset>
		</p:dataList>
		
	
		<h:panelGrid columns="2">
			<p:commandButton process="@form" value="Új jövedelem hozzáadása" action="#{customerMaintBean.addIncome()}" update="incomes" disabled="#{customerMaintBean.loanApplication.status gt 2}"></p:commandButton>
			<p:commandButton process="@form" value="Mentés" disabled="#{customerMaintBean.loanApplication.status gt 2}" />
			<p:commandButton process="@form" value="Törlés" action="#{customerMaintBean.deleteIncome()}" update="incomes" disabled="#{customerMaintBean.loanApplication.status gt 2}"></p:commandButton>
			<p:inputText id="delete" value="#{customerMaintBean.deleteIncomeNumber}" />
			<p:message for="delete" />
		</h:panelGrid>
	</h:form>
</ui:composition>